<!--
Author: W3layouts
Author URL: http://w3layouts.com
-->

<!DOCTYPE html>
<!--suppress ALL-->
<html xmlns:th="http://www.thymeleaf.org">

<head>
	<title>课程通 — 登录</title>

	<!-- Meta tags -->
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">

	<!-- Style -->
	<link rel="stylesheet" href="../css/style.css" type="text/css" media="all" />
	<script src="../js/jquery.js"></script>
	<script src="../layui/layui.js"></script>
</head>

<body>
	<!-- login form -->
	<section class="w3l-login">
		<div class="overlay">
			<div class="wrapper">
				<div class="logo">
					<a class="brand-logo" href="student/index.html">课程通</a>
				</div>
				<div class="form-section">
					<h3>登录</h3>
					<h6>To continue with Us</h6>
					<form action="#" method="post" class="signin-form">
						<div class="form-input">
							<input type="text" placeholder="账户" id="uAccount" autofocus>
						</div>
						<div class="form-input">
							<input type="password" placeholder="密码" id="uPassWord">
						</div>
						<label class="check-remaind">
							<input type="checkbox">
							<span class="checkmark"></span>
							<p class="remember">Remember me</p>
						</label>
						<button type="button"class="btn btn-success" id="loginBtn">登录</button>
						<div class="new-signup">
							<a href="#reload" class="signuplink">忘记账号或密码?</a>
						</div>
					</form>
					<p class="signup">Don’t have account yet? <a th:href="@{/toUserRegister}" class="signuplink">注册</a></p>
				</div>
			</div>
		</div>
		<div id='stars'></div>
		<div id='stars2'></div>
		<div id='stars3'></div>

		<!-- copyright -->
		<div class="copy-right">
			<p>&copy; 2020 Snow Login Form. All rights reserved | Design by <a href="http://w3layouts.com/" target="_blank">W3Layouts</a></p>
		</div>
		<!-- //copyright -->
	</section>

	<!-- /login form -->
</body>

</html>

<script>
  	//登录
	$("#loginBtn").click(function () {
	var uAccount = $("#uAccount").val();
	var uPassWord = $("#uPassWord").val();

	var url = "/user/dologin";
	var param = {"uAccount" : uAccount, "uPassWord" : uPassWord};
	$.post(url, param, function (data) {
	if(data.code != 200){
		layer.msg(data.msg);
	} else {
		layer.msg(data.msg);
		location.href="/toindex";
	}
	}, "json");
});
</script>